<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是使用repo——xml文件说明的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV03-repo-04-xml文件说明">
<meta property="og:url" content="https://sumumm.github.io/post/ea5e182c.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是使用repo——xml文件说明的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/59cb979be0089ac55a5a04aade291b5b.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241023075652925.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025203454736.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025203635562.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025203711635.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025204134069.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025214648113.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025220741076.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025221004524.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025222139421.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025222940599.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025223320318.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241023220323126.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025223640300.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025065829128.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025231127796.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025231146557.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025231404349.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025233049538.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025234826857.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025234902777.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025235444745.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026074004990.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026074125575.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026074501572.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026075406236.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026075606234.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026223334255.png">
<meta property="article:published_time" content="2024-10-26T14:41:02.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.071Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="Git">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/59cb979be0089ac55a5a04aade291b5b.png">


<link rel="canonical" href="https://sumumm.github.io/post/ea5e182c.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":"","permalink":"https://sumumm.github.io/post/ea5e182c.html","path":"post/ea5e182c.html","title":"LV03-repo-04-xml文件说明"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV03-repo-04-xml文件说明 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81xml%E6%96%87%E4%BB%B6%E7%A4%BA%E4%BE%8B"><span class="nav-text">一、xml文件示例</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%AE%89%E5%8D%93%E6%BA%90%E7%A0%81%E7%9A%84default-xml"><span class="nav-text">1. 安卓源码的default.xml</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E4%B8%BB%E8%A6%81%E7%BB%93%E6%9E%84"><span class="nav-text">2. 主要结构</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-manifest"><span class="nav-text">2.1 manifest</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-remote"><span class="nav-text">2.2 remote</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-default"><span class="nav-text">2.3 default</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-project"><span class="nav-text">2.4 project</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-5-manifest-server"><span class="nav-text">2.5 manifest-server</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-6-include"><span class="nav-text">2.6 include</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-7-remove-project"><span class="nav-text">2.7 remove-project</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-8-copyfile"><span class="nav-text">2.8 copyfile</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-9-linkfile"><span class="nav-text">2.9 linkfile</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E4%B8%80%E5%BC%A0%E5%9B%BE%E6%8E%8C%E6%8F%A1%EF%BC%9F"><span class="nav-text">3. 一张图掌握？</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E5%AE%9E%E4%BE%8B%E5%88%86%E6%9E%90"><span class="nav-text">二、实例分析</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E6%8B%89%E5%8F%96%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E4%BB%93%E5%BA%93"><span class="nav-text">1. 拉取最新版本仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-%E6%B8%85%E5%8D%95%E5%BA%93%E6%96%87%E4%BB%B6"><span class="nav-text">1.1 清单库文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E5%88%9D%E5%A7%8B%E5%8C%96repo%E7%AE%A1%E7%90%86%E7%9B%AE%E5%BD%95"><span class="nav-text">1.2 初始化repo管理目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-3-%E5%AF%B9%E6%AF%94%E6%8F%90%E4%BA%A4%E8%AE%B0%E5%BD%95"><span class="nav-text">1.3 对比提交记录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-4-%E7%9C%8B%E4%B8%80%E4%B8%8B%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%EF%BC%9F"><span class="nav-text">1.4 看一下远程仓库？</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%8A%A0%E4%B8%80%E4%B8%AAgitee%E4%BB%93%E5%BA%93"><span class="nav-text">2. 加一个gitee仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-remote-name%E7%9B%B8%E5%90%8C%E4%BC%9A%E6%80%8E%E6%A0%B7%EF%BC%9F"><span class="nav-text">2.1 remote name相同会怎样？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-remote-name%E4%B8%8D%E5%90%8C%E7%9A%84%E6%83%85%E5%86%B5"><span class="nav-text">2.2 remote name不同的情况</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-alias%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="nav-text">3. alias的使用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#3-1-%E6%B8%85%E5%8D%95%E5%BA%93%E6%96%87%E4%BB%B6"><span class="nav-text">3.1 清单库文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-2-%E5%88%9D%E5%A7%8B%E5%8C%96repo%E7%AE%A1%E7%90%86%E7%9B%AE%E5%BD%95"><span class="nav-text">3.2 初始化repo管理目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-3-%E7%9C%8B%E4%B8%80%E4%B8%8B%E8%BF%9C%E7%A8%8B%E4%BB%93%E5%BA%93%EF%BC%9F"><span class="nav-text">3.3 看一下远程仓库？</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E6%8B%89%E5%8F%96%E6%8C%87%E5%AE%9A%E7%89%88%E6%9C%AC"><span class="nav-text">4. 拉取指定版本</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#4-1-%E6%B8%85%E5%8D%95%E5%BA%93%E6%96%87%E4%BB%B6"><span class="nav-text">4.1 清单库文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-2-%E5%88%9D%E5%A7%8B%E5%8C%96repo%E7%AE%A1%E7%90%86%E7%9B%AE%E5%BD%95"><span class="nav-text">4.2 初始化repo管理目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-3-%E7%9C%8B%E4%B8%80%E4%B8%8B%E6%8F%90%E4%BA%A4%E8%AE%B0%E5%BD%95"><span class="nav-text">4.3 看一下提交记录</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-%E6%8B%89%E5%8F%96%E4%B8%8D%E5%90%8C%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%BB%93%E5%BA%93"><span class="nav-text">5. 拉取不同服务器仓库</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-%E6%8B%89%E5%8F%96%E6%8C%87%E5%AE%9A%E5%88%86%E6%94%AF"><span class="nav-text">6. 拉取指定分支</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#6-1-%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E5%88%86%E6%94%AF"><span class="nav-text">6.1 创建一个分支</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-2-%E6%B8%85%E5%8D%95%E5%BA%93"><span class="nav-text">6.2 清单库</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-3-%E5%88%9D%E5%A7%8B%E5%8C%96repo%E7%AE%A1%E7%90%86%E7%9B%AE%E5%BD%95"><span class="nav-text">6.3 初始化repo管理目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-4-%E7%9C%8B%E4%B8%80%E4%B8%8B%E6%8F%90%E4%BA%A4%E8%AE%B0%E5%BD%95"><span class="nav-text">6.4 看一下提交记录</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-%E6%8C%87%E5%AE%9Aclone%E7%9A%84%E6%B7%B1%E5%BA%A6"><span class="nav-text">7. 指定clone的深度</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#7-1-%E6%B8%85%E5%8D%95%E5%BA%93"><span class="nav-text">7.1 清单库</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#7-2-%E5%88%9D%E5%A7%8B%E5%8C%96repo%E7%AE%A1%E7%90%86%E7%9B%AE%E5%BD%95"><span class="nav-text">7.2 初始化repo管理目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#7-3-%E6%9F%A5%E7%9C%8Buboot%E7%9A%84%E6%8F%90%E4%BA%A4%E8%AE%B0%E5%BD%95"><span class="nav-text">7.3 查看uboot的提交记录</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#8-%E6%8C%87%E5%AE%9Atag"><span class="nav-text">8. 指定tag</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#8-1-%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AAtag"><span class="nav-text">8.1 创建一个tag</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-2-%E6%B8%85%E5%8D%95%E5%BA%93"><span class="nav-text">8.2 清单库</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-3-%E5%88%9D%E5%A7%8B%E5%8C%96repo%E7%AE%A1%E7%90%86%E7%9B%AE%E5%BD%95"><span class="nav-text">8.3 初始化repo管理目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-4-%E6%9B%B4%E6%96%B0%E6%B8%85%E5%8D%95%E5%BA%93%E6%96%87%E4%BB%B6"><span class="nav-text">8.4 更新清单库文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#8-5-%E7%9C%8B%E4%B8%80%E4%B8%8B%E6%8F%90%E4%BA%A4%E8%AE%B0%E5%BD%95"><span class="nav-text">8.5 看一下提交记录</span></a></li></ol></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/ea5e182c.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV03-repo-04-xml文件说明 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV03-repo-04-xml文件说明
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2024-10-26 22:41:02" itemprop="dateCreated datePublished" datetime="2024-10-26T22:41:02+08:00">2024-10-26</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/" itemprop="url" rel="index"><span itemprop="name">开发工具</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/" itemprop="url" rel="index"><span itemprop="name">03版本控制</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>8.4k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>31 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是使用repo——xml文件说明的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.2的64位版本</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.6.0 build-24238078</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr>    <tr>        <td align="center" rowspan="3">Linux开发板环境</td>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr><td align="center">参考资料  </td><td align="center">相关说明</td></tr>    <tr><td align="left">Git 官网</td><td align="left"><a href="https://git-scm.com/" target="_blank">https://git-scm.com/ <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">Git 官方文档</td><td align="left"><a href="https://git-scm.com/doc" target="_blank">https://git-scm.com/doc <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">Pro Git Book</td><td align="left"><a href="https://git-scm.com/book/zh/v2" target="_blank">https://git-scm.com/book/zh/v2 <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">Git 快速使用指南</td><td align="left"><a href="https://training.github.com/downloads/zh_CN/github-git-cheat-sheet/" target="_blank">https://training.github.com/downloads/zh_CN/github-git-cheat-sheet/ <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">Visual Git Cheat Sheet</td><td align="left"><a href="https://ndpsoftware.com/git-cheatsheet.html#loc=index" target="_blank">https://ndpsoftware.com/git-cheatsheet.html#loc=index <i class="fa fa-external-link-alt"></i> </a></td></tr>    <tr><td align="left">Repo 工具使用介绍 - Gitee.com</td><td align="left"><a href="https://gitee.com/help/articles/4316#article-header0" target="_blank">https://gitee.com/help/articles/4316#article-header0 <i class="fa fa-external-link-alt"></i> </a></td></tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="0">---</td>        <td align="left"><a href="" target="_blank">---</a></td>        <td align="left">---</td>    </tr></table>
              </div>
            </details>

<p>这一篇其实可以查看repo源码仓库中docs&#x2F;manifest-format.md（<a target="_blank" rel="noopener" href="https://gitee.com/oschina/repo/blob/fork_flow/docs/manifest-format.md">docs&#x2F;manifest-format.md · 开源中国&#x2F;repo - 码云 - 开源中国 (gitee.com)</a>）</p>
<h1 id="一、xml文件示例"><a href="#一、xml文件示例" class="headerlink" title="一、xml文件示例"></a><font size=3>一、xml文件示例</font></h1><p>也可以参考<a target="_blank" rel="noopener" href="https://gitee.com/openharmony-sig/manifest">OpenHarmony-SIG&#x2F;manifest</a>中的 <a target="_blank" rel="noopener" href="https://gitee.com/openharmony-sig/manifest/blob/master/devboard_niobeu4.xml">devboard_niobeu4.xml · OpenHarmony-SIG&#x2F;manifest - Gitee.com</a></p>
<h2 id="1-安卓源码的default-xml"><a href="#1-安卓源码的default-xml" class="headerlink" title="1. 安卓源码的default.xml"></a><font size=3>1. 安卓源码的default.xml</font></h2><p>这里写个笔记总结记录一下xml文件中关键的几个参数。这里是以安卓源码中的default.xml为例：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!--</span></span><br><span class="line"><span class="comment">    remote:标签指定远程仓库的名字，</span></span><br><span class="line"><span class="comment">    fetch :是所有git url真正路径的前缀，所有 git 的 project name加上这个前缀，就是 git url的真正路径；</span></span><br><span class="line"><span class="comment">    review：指定Gerrit 的服务器名，用于repo upload操作 </span></span><br><span class="line"><span class="comment">--&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">remote</span>  <span class="attr">name</span>=<span class="string">&quot;aosp&quot;</span></span></span><br><span class="line"><span class="tag">           <span class="attr">fetch</span>=<span class="string">&quot;..&quot;</span></span></span><br><span class="line"><span class="tag">           <span class="attr">review</span>=<span class="string">&quot;https://android-review.googlesource.com/&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!-- </span></span><br><span class="line"><span class="comment">	default:标签设定所有projects的默认属性值，如果在project元素里没有指定一个属性，则使用 default 元素的属性值   </span></span><br><span class="line"><span class="comment">--&gt;</span></span><br><span class="line"></span><br><span class="line">  <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;refs/tags/android-10.0.0_r45&quot;</span></span></span><br><span class="line"><span class="tag">           <span class="attr">remote</span>=<span class="string">&quot;aosp&quot;</span></span></span><br><span class="line"><span class="tag">           <span class="attr">sync-j</span>=<span class="string">&quot;4&quot;</span> /&gt;</span></span><br><span class="line">           </span><br><span class="line"><span class="comment">&lt;!-- project </span></span><br><span class="line"><span class="comment">    name  : git 的名称,用户生成git url. URL格式是: $&#123;remote fetch&#125;/$&#123;project name&#125;.git 其中的fetch就是上面remote中的fetch元素.name 就是此处的name;</span></span><br><span class="line"><span class="comment">    path  : clone 到本地的git的工作目录,如果没有配置,跟name一样;</span></span><br><span class="line"><span class="comment">    remote: 定义remote name, 如果没有定义的话,就用default中定义的remote name;</span></span><br><span class="line"><span class="comment">    reversion: 指定需要获取的git提交点,可以定义成固定的branch,或者是明确的commit的哈希值;</span></span><br><span class="line"><span class="comment">    groups: 列出project所属的组,以空格或者逗号分隔多个组名.所有的project都自动属于&quot;all&quot;组. </span></span><br><span class="line"><span class="comment">--&gt;</span></span><br><span class="line">    </span><br><span class="line">  <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;build/make&quot;</span> <span class="attr">name</span>=<span class="string">&quot;platform/build&quot;</span> <span class="attr">groups</span>=<span class="string">&quot;pdk&quot;</span> &gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">copyfile</span> <span class="attr">src</span>=<span class="string">&quot;core/root.mk&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;Makefile&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;CleanSpec.mk&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;build/CleanSpec.mk&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;buildspec.mk.default&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;build/buildspec.mk.default&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;core&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;build/core&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;envsetup.sh&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;build/envsetup.sh&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;target&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;build/target&quot;</span> /&gt;</span></span><br><span class="line">      </span><br><span class="line"><span class="comment">&lt;!-- src 表示在build/make/tools目录, dest表示本地路径build/tools软件链接文件链接到src     </span></span><br><span class="line"><span class="comment">--&gt;</span></span><br><span class="line">      </span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;tools&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;build/tools&quot;</span> /&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">project</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;build/blueprint&quot;</span> <span class="attr">name</span>=<span class="string">&quot;platform/build/blueprint&quot;</span> <span class="attr">groups</span>=<span class="string">&quot;pdk,tradefed&quot;</span> /&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;build/kati&quot;</span> <span class="attr">name</span>=<span class="string">&quot;platform/build/kati&quot;</span> <span class="attr">groups</span>=<span class="string">&quot;pdk,tradefed&quot;</span> /&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;build/soong&quot;</span> <span class="attr">name</span>=<span class="string">&quot;platform/build/soong&quot;</span> <span class="attr">groups</span>=<span class="string">&quot;pdk,tradefed&quot;</span> &gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;root.bp&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;Android.bp&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">linkfile</span> <span class="attr">src</span>=<span class="string">&quot;bootstrap.bash&quot;</span> <span class="attr">dest</span>=<span class="string">&quot;bootstrap.bash&quot;</span> /&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">project</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;tools/trebuchet&quot;</span> <span class="attr">name</span>=<span class="string">&quot;platform/tools/trebuchet&quot;</span> <span class="attr">groups</span>=<span class="string">&quot;tools,cts,pdk,pdk-cw-fs,pdk-fs&quot;</span> /&gt;</span></span><br><span class="line">  <span class="comment">&lt;!-- ...... --&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">repo-hooks</span> <span class="attr">in-project</span>=<span class="string">&quot;platform/tools/repohooks&quot;</span> <span class="attr">enabled-list</span>=<span class="string">&quot;pre-upload&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>后面我们详细学习一下。</p>
<h2 id="2-主要结构"><a href="#2-主要结构" class="headerlink" title="2. 主要结构"></a><font size=3>2. 主要结构</font></h2><h3 id="2-1-manifest"><a href="#2-1-manifest" class="headerlink" title="2.1 manifest"></a><font size=3>2.1 manifest</font></h3><p><code>&lt;manifest&gt;</code> 标签：用于标识整个xml配置文件的开始和结束。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">可以包含的子元素</span><br><span class="line"><span class="meta">&lt;!DOCTYPE <span class="keyword">manifest</span> [</span></span><br><span class="line"><span class="meta">  <span class="meta">&lt;!ELEMENT <span class="keyword">manifest</span> (<span class="keyword">notice</span>?,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">remote</span>*,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">default</span>?,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">manifest-server</span>?,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">remove-project</span>*,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">project</span>*,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">extend-project</span>*,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">repo-hooks</span>?,</span></span></span><br><span class="line"><span class="meta"><span class="meta">                      <span class="keyword">include</span>*)&gt;</span></span></span><br><span class="line"><span class="meta"></span></span><br></pre></td></tr></table></figure>

<p>这个是配置的顶层元素，即根标志。</p>
<h3 id="2-2-remote"><a href="#2-2-remote" class="headerlink" title="2.2 remote"></a><font size=3>2.2 remote</font></h3><p><code>&lt;remote&gt;</code> 标签：用于指定远程仓库的信息。可以指定一个或多个远程元素。每个远程元素指定一个Git URL。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">  <span class="meta">&lt;!ELEMENT <span class="keyword">remote</span> <span class="keyword">EMPTY</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">remote</span> <span class="keyword">name</span>         <span class="keyword">ID</span>    <span class="keyword">#REQUIRED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">remote</span> <span class="keyword">alias</span>        <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">remote</span> <span class="keyword">fetch</span>        <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">remote</span> <span class="keyword">pushurl</span>      <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">remote</span> <span class="keyword">review</span>       <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">remote</span> <span class="keyword">revision</span>     <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"></span><br><span class="line">例子1:</span><br><span class="line"><span class="tag">&lt;<span class="name">remote</span> <span class="attr">fetch</span>=<span class="string">&quot;..&quot;</span> <span class="attr">name</span>=<span class="string">&quot;zsgit&quot;</span> <span class="attr">review</span>=<span class="string">&quot;gerrit.xxxxx.com&quot;</span>/&gt;</span></span><br><span class="line"></span><br><span class="line">例子2:</span><br><span class="line"><span class="tag">&lt;<span class="name">remote</span> <span class="attr">fetch</span>=<span class="string">&quot;ssh://gerrit-sw.example.com:20418/&quot;</span> <span class="attr">name</span>=<span class="string">&quot;gerrit_01&quot;</span> <span class="attr">review</span>=<span class="string">&quot;gerrit.xxxxx.com&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">remote</span> <span class="attr">fetch</span>=<span class="string">&quot;ssh://gerrit-os.example.com:20418/&quot;</span> <span class="attr">name</span>=<span class="string">&quot;gerrit_02&quot;</span> <span class="attr">review</span>=<span class="string">&quot;gerrit.xxxxx.com&quot;</span>/&gt;</span></span><br></pre></td></tr></table></figure>

<p>（1）<strong>name</strong>：在每一个.git&#x2F;config文件的remote项中用到这个name，即表示每个<strong>git的远程服务器的名字</strong>(这个名字很关键，如果多个remote属性的话，default属性中需要指定default remote)。git pull、get fetch的时候会用到这个remote name。一个项目清单中的代码可以来自不同服务器，所以remote元素可以有多个，用于存在多个git远程服务器的情况。就比如我们创建好本地版本库的时候要和远程仓库建立连接，我们会用以下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote add origin git@github.com:sumumm/git-example.git</span><br></pre></td></tr></table></figure>

<p>这里的origin就相当于这里的name。</p>
<p>（2）alias ：远程git服务器的别名，如果指定了，则会覆盖name的设定。在一个manifest中，name不能重名，但alias可以重名，可以用来指向不同的remote url。当有多个remote时，远程仓库名称会不一样，为了保持远程仓库名称相同便于管理，可以通过该变量为仓库取别名。通常name不为origin时,可以将别名取为origin。</p>
<p>（3）<strong>fetch</strong> ：所有git url真正路径的前缀，所有git 的project name(就是后面的project标签的name元素)加上这个前缀，就是git url的真正路径。如果使用此remote的所有项目的前缀和manifest仓库<strong>前置</strong>一致的话，可以使用<code>...</code>代替。注意不包含仓库名。</p>
<p>（4）pushurl：设置git push 使用的url地址, fetch 和 push 可以是2个不同的url。</p>
<p>（5）review ：指定Git的服务器名，用于repo upload（上传所有仓库的提交记录到服务器）。如果没有指定，则repo upload没有效果。通常跟fetch变量保持一致即可。</p>
<p>（6）revision：git分支的名字，例如master或者refs&#x2F;heads&#x2F;master。</p>
<h3 id="2-3-default"><a href="#2-3-default" class="headerlink" title="2.3 default"></a><font size=3>2.3 default</font></h3><p><code>&lt;default&gt;</code>标签：用于指定project标签的默认参数。如果在project元素里没有指定一个属性，则使用default元素的属性值。需要注意的是<strong>default元素只能有一个</strong>。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!ELEMENT <span class="keyword">default</span> <span class="keyword">EMPTY</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">remote</span>      <span class="keyword">IDREF</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">revision</span>    <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">dest-branch</span> <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">upstream</span>    <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">sync-j</span>      <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">sync-c</span>      <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">sync-s</span>      <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">default</span> <span class="keyword">sync-tags</span>   <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>（1）remote ：为<code>&lt;project&gt;</code>标签中的<code>remote</code>属性指定默认值。其实就是之前定义的某一个<code>&lt;remote&gt;</code>标签中name属性值，用于指定使用哪一个远程git服务器。（上面remote属性中提到过，多个remote的时候需要指定default remote，就是这里设置了）。</p>
<p>（2）revision ：指定默认需要获取的git提交点，可以是master, refs&#x2F;heads&#x2F;master, tag或者某次提交的哈希字符串值。如果不设置的话，默认下载当前project，默认分支上的最新代码。</p>
<p>（3）sync_j ： 在repo sync中默认并行的数目。</p>
<p>（4）sync_c ：如果设置为true，则只同步指定的分支(revision 属性指定)，而不是所有的ref内容</p>
<p>（5）sync_s ： 如果设置为true，则会同步git的子项目</p>
<p>（6）sync-tags: 控制是否下载tags标签</p>
<h3 id="2-4-project"><a href="#2-4-project" class="headerlink" title="2.4 project"></a><font size=3>2.4 project</font></h3><p><code>&lt;project&gt;</code> 标签：用于指定具体仓库的名称、存储路径，远程仓库名称、分支等单个仓库下载所需的信息。就是指定一个需要clone的git仓库。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">  <span class="meta">&lt;!ELEMENT <span class="keyword">project</span> (<span class="keyword">annotation</span>*,</span></span><br><span class="line"><span class="meta">                     <span class="keyword">project</span>*,</span></span><br><span class="line"><span class="meta">                     <span class="keyword">copyfile</span>*,</span></span><br><span class="line"><span class="meta">                     <span class="keyword">linkfile</span>*)&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">name</span>        <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">path</span>        <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">remote</span>      <span class="keyword">IDREF</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">revision</span>    <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">dest-branch</span> <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">groups</span>      <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">sync-c</span>      <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">sync-s</span>      <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">sync-tags</span>   <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">upstream</span> <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">clone-depth</span> <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line">  <span class="meta">&lt;!ATTLIST <span class="keyword">project</span> <span class="keyword">force-path</span> <span class="keyword">CDATA</span> <span class="keyword">#IMPLIED</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">groups</span>=<span class="string">&quot;zs_amss&quot;</span> <span class="attr">name</span>=<span class="string">&quot;AMSS/adsp_proc&quot;</span> <span class="attr">path</span>=<span class="string">&quot;AMSS/adsp_proc&quot;</span>  /&gt;</span></span><br></pre></td></tr></table></figure>

<p>（1）<strong>name</strong> ：仓库的名称，与<code>&lt;remote&gt;</code>标签中指定的<code>fetch</code>远程仓库的路径前缀拼接，形成完整代码下载地址（git url）。URL格式是：<code>$&#123;remote fetch&#125;/$&#123;project name&#125;.git</code> 其中的 fetch就是上面提到的remote 中的fetch元素。</p>
<p>（2）<strong>path</strong> ：仓库定git clone下载下来后代码在本地保存的路径（我自己理解就是下载下来后的目录名，可以与远程仓库不同的）。如果没有指定，则以name作为子目录名。</p>
<p>（3<strong>）remote</strong> ：指定远程仓库<code>&lt;remote&gt;</code>标签中的name，从而获取其仓库下载地址前缀。如果没有定义的话就用default中定义的remote name。如果想要管理不同的git服务器上的仓库，那么这里就必须要指定使用哪一个remote name。</p>
<p>（4）<strong>revision</strong> ：指定代码下载的提交点，可以是分支master, refs&#x2F;heads&#x2F;master、 tag（tag的话不能只写tag名称，要写成refs&#x2F;tags&#x2F;tag_name）或者明确的commit 哈希值（根据后面的测试，这里必须要是完整的那一个哈希值）。</p>
<p>（5）groups ：列出project所属的组，以空格或者逗号分隔多个组名。所有的project都自动属于”all”组。每一个project自动属于<code>name:&#39;name&#39; </code>和<code>path:&#39;path&#39;</code>组。例如<code>&lt;project name=&quot;monkeys&quot; path=&quot;barrel-of&quot;/&gt;</code>，它自动属于default, name:monkeys, and path:barrel-of组。如果一个project属于notdefault组，则，repo sync时不会下载。</p>
<p>（6）sync_c ：如果设置为true，则只同步指定的分支(revision 属性指定)，而不是所有的ref内容。</p>
<p>（7）sync_s ： 如果设置为true，则会同步git的子项目.</p>
<p>（8）upstream ：在哪个git分支可以找到一个SHA1。用于同步revision锁定的manifest(-c 模式)。该模式可以避免同步整个ref空间</p>
<p>（9）annotation ：可以有0个或多个annotation，格式是name-value，repo forall命令是会用来定义环境变量。</p>
<p>（10）clone-depth：该设置获取此项目时要使用的深度，相当于git clone –depth参数。</p>
<blockquote>
<p>注意：必须包含 name 和 path 属性，name 用于指定远程仓库位置，path 指定下载后的代码相对路径。</p>
</blockquote>
<h3 id="2-5-manifest-server"><a href="#2-5-manifest-server" class="headerlink" title="2.5 manifest-server"></a><font size=3>2.5 manifest-server</font></h3><p>它的url属性用于指定manifest服务的URL，通常是一个XML RPC 服务。它要支持以下RPC方法：</p>
<p>（1）GetApprovedManifest(branch, target) ：返回一个manifest用于指示所有projects的分支和编译目标。target参数来自环境变量TARGET_PRODUCT和TARGET_BUILD_VARIANT，组成$TARGET_PRODUCT-$TARGET_BUILD_VARIANT</p>
<p>（2）GetManifest(tag) ：返回指定tag的manifest</p>
<h3 id="2-6-include"><a href="#2-6-include" class="headerlink" title="2.6 include"></a><font size=3>2.6 include</font></h3><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!ELEMENT <span class="keyword">include</span> <span class="keyword">EMPTY</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">include</span> <span class="keyword">name</span> <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>通过name属性可以引入另外一个manifest文件(路径相对与当前的manifest.xml 的路径)。</p>
<p>name ：另一个需要导入的manifest文件名字。可以在当前的路径下添加一个another_manifest.xml，这样可以在另一个xml中添加或删除project。</p>
<h3 id="2-7-remove-project"><a href="#2-7-remove-project" class="headerlink" title="2.7 remove-project"></a><font size=3>2.7 remove-project</font></h3><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!ELEMENT <span class="keyword">remove-project</span> <span class="keyword">EMPTY</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">remove-project</span> <span class="keyword">name</span>  <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>从内部的manifest表中删除指定的project。经常用于本地的manifest文件，用户可以替换一个project的定义。</p>
<h3 id="2-8-copyfile"><a href="#2-8-copyfile" class="headerlink" title="2.8 copyfile"></a><font size=3>2.8 copyfile</font></h3><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!ELEMENT <span class="keyword">copyfile</span> <span class="keyword">EMPTY</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">copyfile</span> <span class="keyword">src</span>  <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">copyfile</span> <span class="keyword">dest</span> <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>project元素的子元素，每个元素描述了一对 src-dest 文件对。</p>
<ul>
<li>src: 是相对于project标签的path属性值的相对路径。</li>
<li>dest: 是相对于当前目录(执行repo init和repo sync命令的目录)的路径。</li>
</ul>
<p>可以将零个或多个copyfile元素指定为项目元素的子元素。每个元素描述一个src-dest文件对；在repo sync命令中，src文件将被复制到dest位置。通常会被用于 README 或 Makefile 或其他构建脚本。</p>
<p>“src”和“dest”必须是文件。不允许使用目录或符号链接。中间路径也不能是符号链接。如果缺少“dest”的父目录，将自动创建。</p>
<h3 id="2-9-linkfile"><a href="#2-9-linkfile" class="headerlink" title="2.9 linkfile"></a><font size=3>2.9 linkfile</font></h3><p><code>&lt;linkfile&gt;</code>标签：用于创建软连接文件，是<code>&lt;project&gt;</code>标签的子元素，需要写在<code>&lt;project&gt;</code>与<code>&lt;/project&gt;</code>之间。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!ELEMENT <span class="keyword">linkfile</span> <span class="keyword">EMPTY</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">linkfile</span> <span class="keyword">src</span> <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br><span class="line"><span class="meta">&lt;!ATTLIST <span class="keyword">linkfile</span> <span class="keyword">dest</span> <span class="keyword">CDATA</span> <span class="keyword">#REQUIRED</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>project 的子节点属性。它就像copyfile一样，与copyfile同时运行，但它不是复制，而是创建一个符号链接。符号链接在“dest”（相对于树的顶部）创建，并指向由“src”指定的路径，这是项目中的路径。如果缺少“dest”的父目录，将自动创建。符号链接的目标可以是一个文件或目录，但它不能指向repo客户端之外。</p>
<ul>
<li>dest属性：软链接生成的路径</li>
<li>src属性：软链接链接的文件所在路径</li>
</ul>
<h2 id="3-一张图掌握？"><a href="#3-一张图掌握？" class="headerlink" title="3. 一张图掌握？"></a><font size=3>3. 一张图掌握？</font></h2><p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/59cb979be0089ac55a5a04aade291b5b.png" alt="repo的清单文件和目录结构"></p>
<h1 id="二、实例分析"><a href="#二、实例分析" class="headerlink" title="二、实例分析"></a><font size=3>二、实例分析</font></h1><h2 id="1-拉取最新版本仓库"><a href="#1-拉取最新版本仓库" class="headerlink" title="1. 拉取最新版本仓库"></a><font size=3>1. 拉取最新版本仓库</font></h2><h3 id="1-1-清单库文件"><a href="#1-1-清单库文件" class="headerlink" title="1.1 清单库文件"></a><font size=3>1.1 清单库文件</font></h3><p>我使用自己之前创建的清单库：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/c6be5486e6cb9316787556deb299a1584932f023/">repo-manifest: repo的清单库 - Gitee.com</a>。修改清单库文件如下：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- remote 指定远程仓库的信息 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    name    标志该仓库的远程名称，与&lt;project&gt;标签中的remote属性需要对应起来。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    fetch   用于指定远程仓库的路径前缀(注意不包含仓库名)。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    alias   由于下载代码时是通过远程仓库名remote来确定下载路径前缀的，当有多个remote时，远程仓库名称会不一样，</span></span><br><span class="line"><span class="comment">                    为了保持远程仓库名称相同便于管理，可以通过该变量为仓库取别名。通常name不为origin时,可以将别名取为 origin --&gt;</span></span><br><span class="line">	<span class="comment">&lt;!--    review  指定Git的服务器名，用于repo upload操作。如果没有指定，则repo upload没有效果。通常跟fetch变量保持一致即可。--&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span> <span class="comment">&lt;!--fetch=&quot;..&quot; 代表使用 repo init -u 指定的相对路径 也可用完整路径，example:https://gitee.com/sumumm/manifest/blob/master/default.xml --&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="comment">&lt;!-- default 用于指定project标签的默认参数 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    remote    为&lt;project&gt;标签中的remote属性指定默认值, 若之后project中不指定，则默认为default中指定的。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    revision  指定默认需要获取的git提交点，可以是master, refs/heads/master, tag或者某次提交的哈希字符串值。</span></span><br><span class="line"><span class="comment">                      如果不设置的话，默认下载当前project，默认分支上的最新代码。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    sync-j    代码同步时线程数 --&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="comment">&lt;!-- project 用于指定具体仓库的名称、存储路径，远程仓库名称、分支等单个仓库下载所需的信息。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    name     仓库的名称，与&lt;remote&gt;标签中指定的fetch远程仓库的路径前缀拼接，形成完整代码下载地址。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    path     仓库下载下来后代码在本地保存的路径。如果没有指定，则以name作为子目录名。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    revision 指定代码下载的提交点，可以是分支、tag或某次提交的哈希字符串值。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!--    remote   指定远程仓库&lt;remote&gt;标签中的name，从而获取其仓库下载地址前缀。 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- git@gitee.com:sumumm/git-example --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> /&gt;</span>  <span class="comment">&lt;!--git@gitee.com:&#123;namespace&#125;/&#123;name&#125;.git name 与 clone 的 url 相关--&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- git@gitee.com:sumumm/openssl.git --&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl--local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> /&gt;</span>  <span class="comment">&lt;!--git@gitee.com:&#123;namespace&#125;/&#123;name&#125;.git name 与 clone 的 url 相关--&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里将会clone两个仓库：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git@gitee.com:sumumm/git-example.git</span><br><span class="line">git@gitee.com:sumumm/openssl.git</span><br></pre></td></tr></table></figure>

<h3 id="1-2-初始化repo管理目录"><a href="#1-2-初始化repo管理目录" class="headerlink" title="1.2 初始化repo管理目录"></a><font size=3>1.2 初始化repo管理目录</font></h3><p>我们修改后提交代码然后执行以下命令初始化一个repo管理目录：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">repo --trace init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br></pre></td></tr></table></figure>

<p>然后我们就会得到这些文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241023075652925.png" alt="image-20241023075652925" style="zoom: 67%;" />

<p>接下来我们clone出所有的仓库：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">repo sync</span><br></pre></td></tr></table></figure>

<p>然后就会clone出我们指定的两个仓库：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025203454736.png" alt="image-20241025203454736" />

<h3 id="1-3-对比提交记录"><a href="#1-3-对比提交记录" class="headerlink" title="1.3 对比提交记录"></a><font size=3>1.3 对比提交记录</font></h3><p>我们来看一下两个仓库的提交记录，会发现默认都是拉取的最新版本：</p>
<ul>
<li>openssl.git</li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025203635562.png" alt="image-20241025203635562" />

<ul>
<li>git-example.git</li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025203711635.png" alt="image-20241025203711635" />

<h3 id="1-4-看一下远程仓库？"><a href="#1-4-看一下远程仓库？" class="headerlink" title="1.4 看一下远程仓库？"></a><font size=3>1.4 看一下远程仓库？</font></h3><p>我们下载下来的仓库应该是对应了远程仓库的，我们执行以下命令看一下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote -v</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025204134069.png" alt="image-20241025204134069" />

<p>可以看到，每一个本地仓库为远程仓库取的名字都叫sumu-gitee。</p>
<h2 id="2-加一个gitee仓库"><a href="#2-加一个gitee仓库" class="headerlink" title="2. 加一个gitee仓库"></a><font size=3>2. 加一个gitee仓库</font></h2><p>我们加一个其他的gitee的开源库：<a target="_blank" rel="noopener" href="https://gitee.com/oschina/repo">repo: Repo 是一个用于批量管理多仓库工程的工具，本仓库主要对 repo 做了二次开发，使其支持 Gitee Fork+PullRequest 流程</a></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git@gitee.com:oschina/repo.git</span><br></pre></td></tr></table></figure>

<h3 id="2-1-remote-name相同会怎样？"><a href="#2-1-remote-name相同会怎样？" class="headerlink" title="2.1 remote name相同会怎样？"></a><font size=3>2.1 remote name相同会怎样？</font></h3><p>清单库文件看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/71b0d5b2611e2eca7e45f7d3f63dd48b37915779">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;gitee.com:oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> /&gt;</span> </span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>这个情况属于remote中name重复，我们可以直接执行下面的命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">repo --trace init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br></pre></td></tr></table></figure>

<p>不出意外的话肯定报错：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025214648113.png" alt="image-20241025214648113" />

<h3 id="2-2-remote-name不同的情况"><a href="#2-2-remote-name不同的情况" class="headerlink" title="2.2 remote name不同的情况"></a><font size=3>2.2 remote name不同的情况</font></h3><p>清单库文件看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/063fb85c47462e931622ab451bdf615557b4dba0/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;gitee.com:oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span>/&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>注意这个时候就需要为不同的仓库地址指定remote名字和revision分支了，因为这里默认写的master分支，但是repo那个仓库默认是main分支。我们修改如下（<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/7fe27bda321bd450b3548bd47cf68e5befa6a48b/">repo-manifest: repo的清单库 - Gitee.com</a>）：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;gitee.com:oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;fork_flow&quot;</span>/&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>然后我们可以正常下载，但是吧就是用repo这命令的话对于其他人的仓库貌似不能用ssh地址，会报错：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025220741076.png" alt="image-20241025220741076" />

<p>所以这里还要修改为https链接，清单库可以看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/58b76e084e0ac04f652b65009853748b0ff71876/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://gitee.com/oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-gitee&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;fork_flow&quot;</span>/&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>我们执行以下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">repo init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br><span class="line">repo sync</span><br></pre></td></tr></table></figure>

<p>这个时候就可以了。我们用以下命令看一下三个仓库的远程仓库名：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote -v</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025221004524.png" alt="image-20241025221004524" />

<p>会发现和每个仓库指定的remote名字一样。</p>
<h2 id="3-alias的使用"><a href="#3-alias的使用" class="headerlink" title="3. alias的使用"></a><font size=3>3. alias的使用</font></h2><p>上一个实验做完，我们可以添加别人的仓库了，但是吧，就是每个仓库远程分支别名都是使用的不一样的名字，我们能不能搞成一样的？就跟平时使用git的时候一样，全部用origin？当然也可以啦，这个时候就需要使用remote标签的alias属性了。</p>
<h3 id="3-1-清单库文件"><a href="#3-1-清单库文件" class="headerlink" title="3.1 清单库文件"></a><font size=3>3.1 清单库文件</font></h3><p>清单库文件看这里<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/41a560932573041c9ca83719c466f09506d2787f/">repo-manifest: repo的清单库 - Gitee.com</a>：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://gitee.com/oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;origin&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;fork_flow&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>需要注意的是，必须要有一个remote标签的name为origin，否则会报这个：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025222139421.png" alt="image-20241025222139421" />

<p>另外需要注意，这里还是需要为<code>https://gitee.com/oschina/repo.git</code>指定remote name。</p>
<h3 id="3-2-初始化repo管理目录"><a href="#3-2-初始化repo管理目录" class="headerlink" title="3.2 初始化repo管理目录"></a><font size=3>3.2 初始化repo管理目录</font></h3><p>我们执行以下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">repo --trace init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br><span class="line">repo sync</span><br></pre></td></tr></table></figure>

<h3 id="3-3-看一下远程仓库？"><a href="#3-3-看一下远程仓库？" class="headerlink" title="3.3 看一下远程仓库？"></a><font size=3>3.3 看一下远程仓库？</font></h3><p>我们执行：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git remote -v</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025222940599.png" alt="image-20241025222940599" />

<p>这样每个远程仓库链接的别名就都一样了。</p>
<h2 id="4-拉取指定版本"><a href="#4-拉取指定版本" class="headerlink" title="4. 拉取指定版本"></a><font size=3>4. 拉取指定版本</font></h2><h3 id="4-1-清单库文件"><a href="#4-1-清单库文件" class="headerlink" title="4.1 清单库文件"></a><font size=3>4.1 清单库文件</font></h3><p>清单库文件看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/51a544b7326a991e359ad9c311d84e5e303f2845/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://gitee.com/oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;origin&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;1a7ff22884d28ab7efba583a9d6cc7627b5f42a6&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;fork_flow&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>我这里指定openssl仓库的版本为1a7ff22。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025223320318.png" alt="image-20241025223320318" />

<p>需要注意的是这里不能写简写1a7ff22， 要写完整的commid id：1a7ff22884d28ab7efba583a9d6cc7627b5f42a6，否则就可能会出现报错：</p>
<p><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241023220323126.png" alt="image-20241023220323126"></p>
<h3 id="4-2-初始化repo管理目录"><a href="#4-2-初始化repo管理目录" class="headerlink" title="4.2 初始化repo管理目录"></a><font size=3>4.2 初始化repo管理目录</font></h3><p>执行以下命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">repo init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br><span class="line">repo sync</span><br></pre></td></tr></table></figure>

<h3 id="4-3-看一下提交记录"><a href="#4-3-看一下提交记录" class="headerlink" title="4.3 看一下提交记录"></a><font size=3>4.3 看一下提交记录</font></h3><p>当成功拉取分支和版本后，我们看一下这个本地的openssl仓库的提交记录：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025223640300.png" alt="image-20241025223640300" />

<p>可以发现最新版本已经在1a7ff22这里了。</p>
<h2 id="5-拉取不同服务器仓库"><a href="#5-拉取不同服务器仓库" class="headerlink" title="5. 拉取不同服务器仓库"></a><font size=3>5. 拉取不同服务器仓库</font></h2><p>这个跟添加一个服务器一样的，清单库可以看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/e8b387ce13df23186c61b457de7f4c7870284565/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://gitee.com/oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-github&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://github.com/sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;origin&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;1a7ff22884d28ab7efba583a9d6cc7627b5f42a6&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;fork_flow&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;hexo-next-tags-plus-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;hexo-next-tags-plus&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-github&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="6-拉取指定分支"><a href="#6-拉取指定分支" class="headerlink" title="6. 拉取指定分支"></a><font size=3>6. 拉取指定分支</font></h2><h3 id="6-1-创建一个分支"><a href="#6-1-创建一个分支" class="headerlink" title="6.1 创建一个分支"></a><font size=3>6.1 创建一个分支</font></h3><p>我们在之前的gitee仓库中多创建一个测试分支：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025065829128.png" alt="image-20241025065829128" />

<h3 id="6-2-清单库"><a href="#6-2-清单库" class="headerlink" title="6.2 清单库"></a><font size=3>6.2 清单库</font></h3><p>清单库可以看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/2251034aa232b2184f17e0abd3904b38853e1e91/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;gitee&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span> <span class="comment">&lt;!--fetch=&quot;..&quot; 代表使用 repo init -u 指定的相对路径 也可用完整路径，example:https://gitee.com/sumumm/manifest/blob/master/default.xml --&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;gitee&quot;</span> /&gt;</span> <span class="comment">&lt;!--revision 为默认的拉取分支，后续提 pr 也以 revision 为默认目标分支--&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- git@gitee.com:sumumm/git-example --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-1&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;repo-demo&quot;</span> /&gt;</span>  <span class="comment">&lt;!--git@gitee.com:&#123;namespace&#125;/&#123;name&#125;.git name 与 clone 的 url 相关--&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- git@gitee.com:sumumm/openssl.git --&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl.git-1&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;1a7ff22884d28ab7efba583a9d6cc7627b5f42a6&quot;</span>/&gt;</span>  <span class="comment">&lt;!--git@gitee.com:&#123;namespace&#125;/&#123;name&#125;.git name 与 clone 的 url 相关--&gt;</span></span><br><span class="line"> </span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;github&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@github.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span> <span class="comment">&lt;!--fetch=&quot;..&quot; 代表使用 repo init -u 指定的相对路径 也可用完整路径，example:https://gitee.com/sumumm/manifest/blob/master/default.xml --&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="comment">&lt;!-- git@github.com:sumumm/git-test.git--&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-test-1&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-test&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;github&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span>/&gt;</span>  <span class="comment">&lt;!--git@gitee.com:&#123;namespace&#125;/&#123;name&#125;.git name 与 clone 的 url 相关--&gt;</span></span><br><span class="line">    </span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h3 id="6-3-初始化repo管理目录"><a href="#6-3-初始化repo管理目录" class="headerlink" title="6.3 初始化repo管理目录"></a><font size=3>6.3 初始化repo管理目录</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">repo init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br><span class="line">repo sync</span><br></pre></td></tr></table></figure>

<h3 id="6-4-看一下提交记录"><a href="#6-4-看一下提交记录" class="headerlink" title="6.4 看一下提交记录"></a><font size=3>6.4 看一下提交记录</font></h3><p>就会看到这里其实获取的已经是repo-demo分支的了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025231127796.png" alt="image-20241025231127796" />

<p>我们执行下面的命令：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git branch -a</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025231146557.png" alt="image-20241025231146557" />

<p>就可以看到整个仓库所有分支和当前的分支。</p>
<h2 id="7-指定clone的深度"><a href="#7-指定clone的深度" class="headerlink" title="7. 指定clone的深度"></a><font size=3>7. 指定clone的深度</font></h2><p>对于有一个仓库，比如我后面会学习的uboot：<a target="_blank" rel="noopener" href="https://github.com/nxp-imx/uboot-imx/tree/rel_imx_4.1.15_2.1.0_ga">nxp-imx&#x2F;uboot-imx at rel_imx_4.1.15_2.1.0_ga (github.com)</a></p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025231404349.png" alt="image-20241025231404349" />



<p>这样我们完全clone下来的话会很占地，而且会clone很久，我们手动使用git clone的时候，有一个–depth选项可以用，repo中也是支持的。我们这里还需要指定tag，固定一下版本：<a target="_blank" rel="noopener" href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga">Release rel_imx_4.1.15_2.1.0_ga: MLK-14707 fsl_esdhc: Fix eMMC 1.8v setting issue · nxp-imx&#x2F;uboot-imx (github.com)</a>：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025233049538.png" alt="image-20241025233049538" />

<h3 id="7-1-清单库"><a href="#7-1-清单库" class="headerlink" title="7.1 清单库"></a><font size=3>7.1 清单库</font></h3><p>清单库可以看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/50d67eae8f34a157fc10ee75a6e977af6f360746/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://gitee.com/oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-github&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://github.com/sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;nxp-imx&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://github.com/nxp-imx&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;origin&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;repo-demo&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;1a7ff22884d28ab7efba583a9d6cc7627b5f42a6&quot;</span>/&gt;</span> </span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;fork_flow&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;hexo-next-tags-plus-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;hexo-next-tags-plus&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-github&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;uboot&quot;</span> <span class="attr">name</span>=<span class="string">&quot;uboot-imx&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;nxp-imx&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;rel_imx_4.1.15_2.1.0_ga&quot;</span> <span class="attr">clone-depth</span>=<span class="string">&quot;1&quot;</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>这样直接写标签的话好像报错了（后来发现实际是因为tag的格式写的不对，可以看第8个例子）：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025234826857.png" alt="image-20241025234826857" />

<p>后面还是根据标签找到提交记录：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025234902777.png" alt="image-20241025234902777" />

<p>然后直接拉取这个提交记录了。清单库可以看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/6d61632ca45f64a862cc5a55518da9b538a92c89/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<h3 id="7-2-初始化repo管理目录"><a href="#7-2-初始化repo管理目录" class="headerlink" title="7.2 初始化repo管理目录"></a><font size=3>7.2 初始化repo管理目录</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">repo init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br><span class="line">repo sync</span><br></pre></td></tr></table></figure>

<h3 id="7-3-查看uboot的提交记录"><a href="#7-3-查看uboot的提交记录" class="headerlink" title="7.3 查看uboot的提交记录"></a><font size=3>7.3 查看uboot的提交记录</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241025235444745.png" alt="image-20241025235444745" />

<p>会发现只有一次提交，就是我们上面tag对应的a57b13b942d59719e3621179e98bd8a0ab235088。</p>
<h2 id="8-指定tag"><a href="#8-指定tag" class="headerlink" title="8. 指定tag"></a><font size=3>8. 指定tag</font></h2><h3 id="8-1-创建一个tag"><a href="#8-1-创建一个tag" class="headerlink" title="8.1 创建一个tag"></a><font size=3>8.1 创建一个tag</font></h3><p>前面不是写tag的时候失败了，这里不知道是不是那个仓库的问题，我们还是以这个仓库为例<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/git-example">git-example: 学习Git的时候的测试仓库 (gitee.com)</a>：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026074004990.png" alt="image-20241026074004990" />

<p>这里我们在这个仓库创建一个tag：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">git clone git@gitee.com:sumumm/git-example.git</span><br><span class="line">cd git-example</span><br><span class="line">git mylog</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026074125575.png" alt="image-20241026074125575" />

<p>我们在这里创建一个tag：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git tag V2023_06_23_10_06_53-release f5a3adf</span><br></pre></td></tr></table></figure>

<p>然后推送到远程仓库：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git push origin --tags # 推送所有的tags</span><br></pre></td></tr></table></figure>

<p>然后我们看一下gitee仓库：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026074501572.png" alt="image-20241026074501572" />

<h3 id="8-2-清单库"><a href="#8-2-清单库" class="headerlink" title="8.2 清单库"></a><font size=3>8.2 清单库</font></h3><p>清单库可以看这里：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/04a0179e082be433546b630a5642e285cea50f60/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<h3 id="8-3-初始化repo管理目录"><a href="#8-3-初始化repo管理目录" class="headerlink" title="8.3 初始化repo管理目录"></a><font size=3>8.3 初始化repo管理目录</font></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">repo init --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo --repo-rev= -u https://gitee.com/sumumm/repo-manifest.git -b master -m repo-demo.xml</span><br><span class="line">repo sync</span><br></pre></td></tr></table></figure>

<p>这里执行repo sync的时候直接就报错了：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026075406236.png" alt="image-20241026075406236" />

<p>可以试一下直接git clone：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone -b V2023_06_23_10_06_53-release git@gitee.com:sumumm/git-example.git</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026075606234.png" alt="image-20241026075606234" />

<p>发现我们的tag是存在的。那肯定还是哪里配置不对，后来搜索资料发现，使用tag的时候不能直接写tag名，要加上<code>refs/tags/</code>。</p>
<h3 id="8-4-更新清单库文件"><a href="#8-4-更新清单库文件" class="headerlink" title="8.4 更新清单库文件"></a><font size=3>8.4 更新清单库文件</font></h3><p>后来发现，其实是因为tag的时候不能只写tag名，要这样写：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">refs/tags/tag_name</span><br></pre></td></tr></table></figure>

<p>所以这里更新一下清单库：<a target="_blank" rel="noopener" href="https://gitee.com/sumumm/repo-manifest/tree/2ade85e92ad92bfd7a2c248ff5b25db3c9230d98/">repo-manifest: repo的清单库 - Gitee.com</a></p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=<span class="string">&quot;1.0&quot;</span> encoding=<span class="string">&quot;UTF-8&quot;</span>?&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">manifest</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;git@gitee.com:sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;soschina-gitee&quot;</span> </span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://gitee.com/oschina&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span> </span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;sumu-github&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://github.com/sumumm&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span> </span><br><span class="line">    </span><br><span class="line">    <span class="tag">&lt;<span class="name">remote</span> <span class="attr">name</span>=<span class="string">&quot;nxp-imx&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">alias</span>=<span class="string">&quot;origin&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">fetch</span>=<span class="string">&quot;https://github.com/nxp-imx&quot;</span></span></span><br><span class="line"><span class="tag">            <span class="attr">autodotgit</span>=<span class="string">&quot;true&quot;</span> /&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">default</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span></span></span><br><span class="line"><span class="tag">             <span class="attr">remote</span>=<span class="string">&quot;origin&quot;</span> /&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;git-example-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;git-example&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;refs/tags/V2023_06_23_10_06_53-release&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;openssl-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;openssl&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;1a7ff22884d28ab7efba583a9d6cc7627b5f42a6&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;repo-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;repo&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;soschina-gitee&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;fork_flow&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;hexo-next-tags-plus-local&quot;</span> <span class="attr">name</span>=<span class="string">&quot;hexo-next-tags-plus&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;sumu-github&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;master&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">project</span> <span class="attr">path</span>=<span class="string">&quot;uboot&quot;</span> <span class="attr">name</span>=<span class="string">&quot;uboot-imx&quot;</span> <span class="attr">remote</span>=<span class="string">&quot;nxp-imx&quot;</span> <span class="attr">revision</span>=<span class="string">&quot;a57b13b942d59719e3621179e98bd8a0ab235088&quot;</span> <span class="attr">clone-depth</span>=<span class="string">&quot;1&quot;</span> /&gt;</span> </span><br><span class="line"><span class="tag">&lt;/<span class="name">manifest</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<p>然后重新执行对应的创建以及同步命令之后，就会发现正常拉取了分支了。</p>
<h3 id="8-5-看一下提交记录"><a href="#8-5-看一下提交记录" class="headerlink" title="8.5 看一下提交记录"></a><font size=3>8.5 看一下提交记录</font></h3><p>我们看一下git-example-local的提交记录：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/02%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/03%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6/LV03-repo-04-xml%E6%96%87%E4%BB%B6%E8%AF%B4%E6%98%8E/img/image-20241026223334255.png" alt="image-20241026223334255" />

<p>会发现就处于f5a3adf这次提交啦。</p>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/ea5e182c.html">LV03-repo-04-xml文件说明</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2024年10月26日 - 22:41</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/ea5e182c.html" title="LV03-repo-04-xml文件说明">https://sumumm.github.io/post/ea5e182c.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/Git/" rel="tag"><i class="fa fa-tag"></i> Git</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/7bb80daa.html" rel="prev" title="LV02-05-Makefile-09-GIT与SVN版本号">
                  <i class="fa fa-angle-left"></i> LV02-05-Makefile-09-GIT与SVN版本号
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/58627ebd.html" rel="next" title="LV03-repo-03-从0搭建一个repo管理的项目">
                  LV03-repo-03-从0搭建一个repo管理的项目 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
